/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.fallback.promotion;

import com.enation.app.javashop.core.client.feignimpl.promotion.PromotionScriptClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.promotion.seckill.dos.SeckillApplyDO;
import com.enation.app.javashop.model.promotion.tool.dos.PromotionGoodsDO;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 促销脚本熔断
 *
 * @author zh
 * @version v7.0
 * @date 19/5/27 下午6:44
 * @since v7.0
 */
@Component
public class PromotionScriptClientFallbackFactory extends BaseFallbackFactory<PromotionScriptClientFeignImpl> implements FallbackFactory {

    @Override
    protected PromotionScriptClientFeignImpl fallback() {
        return new PromotionScriptClientFallback();
    }

    /**
     * 促销脚本熔断
     *
     * @author zh
     * @version v7.0
     * @date 19/5/27 下午6:44
     * @since v7.0
     */
    @Component
    public static class PromotionScriptClientFallback implements PromotionScriptClientFeignImpl {

        protected final Logger logger = LoggerFactory.getLogger(this.getClass());


        @Override
        public void createGroupBuyCacheScript(Long promotionId, List<PromotionGoodsDO> goodsList) {
            logger.error("创建参与团购促销活动商品的脚本数据信息异常");
        }

        @Override
        public void deleteGroupBuyCacheScript(Long promotionId, List<PromotionGoodsDO> goodsList) {
            logger.error("删除商品存放在缓存中的团购促销活动相关的脚本数据信息异常");
        }

        @Override
        public void deleteCacheScript(Long promotionId, List<SeckillApplyDO> goodsList) {
            logger.error("删除商品存放在缓存中的限时抢购促销活动相关的脚本数据信息异常");
        }
    }
}
